{"ast":null,"code":"import * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport { render, unmount } from \"rc-util/es/React/render\";\nimport classNames from 'classnames';\nimport { getTargetWaveColor, getValidateContainer } from './util';\nvar WaveEffect = function WaveEffect(props) {\n  var className = props.className,\n    left = props.left,\n    top = props.top,\n    width = props.width,\n    height = props.height,\n    color = props.color,\n    borderRadius = props.borderRadius,\n    scale = props.scale;\n  var divRef = React.useRef(null);\n  var waveStyle = {\n    left: left,\n    top: top,\n    width: width,\n    height: height,\n    borderRadius: borderRadius.map(function (radius) {\n      return \"\".concat(radius, \"px\");\n    }).join(' '),\n    '--wave-scale': scale\n  };\n  if (color) {\n    waveStyle['--wave-color'] = color;\n  }\n  return /*#__PURE__*/React.createElement(CSSMotion, {\n    visible: true,\n    motionAppear: true,\n    motionName: \"wave-motion\",\n    motionDeadline: 5000,\n    onAppearEnd: function onAppearEnd(_, event) {\n      var _a;\n      if (event.deadline || event.propertyName === 'opacity') {\n        var holder = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.parentElement;\n        unmount(holder).then(function () {\n          var _a;\n          (_a = holder.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(holder);\n        });\n      }\n      return false;\n    }\n  }, function (_ref) {\n    var motionClassName = _ref.className;\n    return /*#__PURE__*/React.createElement(\"div\", {\n      ref: divRef,\n      className: classNames(className, motionClassName),\n      style: waveStyle\n    });\n  });\n};\nfunction validateNum(value) {\n  return Number.isNaN(value) ? 0 : value;\n}\nexport default function showWaveEffect(container, node, className) {\n  var nodeStyle = getComputedStyle(node);\n  var nodeRect = node.getBoundingClientRect();\n  // Get wave color from target\n  var waveColor = getTargetWaveColor(node);\n  // Get border radius\n  var borderTopLeftRadius = nodeStyle.borderTopLeftRadius,\n    borderTopRightRadius = nodeStyle.borderTopRightRadius,\n    borderBottomLeftRadius = nodeStyle.borderBottomLeftRadius,\n    borderBottomRightRadius = nodeStyle.borderBottomRightRadius;\n  // Do scale calc\n  var offsetWidth = node.offsetWidth;\n  var scale = validateNum(nodeRect.width / offsetWidth);\n  // Create holder\n  var holder = document.createElement('div');\n  getValidateContainer(container).appendChild(holder);\n  render( /*#__PURE__*/React.createElement(WaveEffect, {\n    left: nodeRect.left,\n    top: nodeRect.top,\n    width: nodeRect.width,\n    height: nodeRect.height,\n    color: waveColor,\n    className: className,\n    scale: scale,\n    borderRadius: [borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius].map(function (radius) {\n      return validateNum(parseFloat(radius) * scale);\n    })\n  }), holder);\n}","map":{"version":3,"names":["React","CSSMotion","render","unmount","classNames","getTargetWaveColor","getValidateContainer","WaveEffect","props","className","left","top","width","height","color","borderRadius","scale","divRef","useRef","waveStyle","map","radius","join","createElement","visible","motionAppear","motionName","motionDeadline","onAppearEnd","_","event","_a","deadline","propertyName","holder","current","parentElement","then","removeChild","_ref","motionClassName","ref","style","validateNum","value","Number","isNaN","showWaveEffect","container","node","nodeStyle","getComputedStyle","nodeRect","getBoundingClientRect","waveColor","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","offsetWidth","document","appendChild","parseFloat"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/_util/wave/WaveEffect.js"],"sourcesContent":["import * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport { render, unmount } from \"rc-util/es/React/render\";\nimport classNames from 'classnames';\nimport { getTargetWaveColor, getValidateContainer } from './util';\nconst WaveEffect = props => {\n  const {\n    className,\n    left,\n    top,\n    width,\n    height,\n    color,\n    borderRadius,\n    scale\n  } = props;\n  const divRef = React.useRef(null);\n  const waveStyle = {\n    left,\n    top,\n    width,\n    height,\n    borderRadius: borderRadius.map(radius => `${radius}px`).join(' '),\n    '--wave-scale': scale\n  };\n  if (color) {\n    waveStyle['--wave-color'] = color;\n  }\n  return /*#__PURE__*/React.createElement(CSSMotion, {\n    visible: true,\n    motionAppear: true,\n    motionName: \"wave-motion\",\n    motionDeadline: 5000,\n    onAppearEnd: (_, event) => {\n      var _a;\n      if (event.deadline || event.propertyName === 'opacity') {\n        const holder = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.parentElement;\n        unmount(holder).then(() => {\n          var _a;\n          (_a = holder.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(holder);\n        });\n      }\n      return false;\n    }\n  }, _ref => {\n    let {\n      className: motionClassName\n    } = _ref;\n    return /*#__PURE__*/React.createElement(\"div\", {\n      ref: divRef,\n      className: classNames(className, motionClassName),\n      style: waveStyle\n    });\n  });\n};\nfunction validateNum(value) {\n  return Number.isNaN(value) ? 0 : value;\n}\nexport default function showWaveEffect(container, node, className) {\n  const nodeStyle = getComputedStyle(node);\n  const nodeRect = node.getBoundingClientRect();\n  // Get wave color from target\n  const waveColor = getTargetWaveColor(node);\n  // Get border radius\n  const {\n    borderTopLeftRadius,\n    borderTopRightRadius,\n    borderBottomLeftRadius,\n    borderBottomRightRadius\n  } = nodeStyle;\n  // Do scale calc\n  const {\n    offsetWidth\n  } = node;\n  const scale = validateNum(nodeRect.width / offsetWidth);\n  // Create holder\n  const holder = document.createElement('div');\n  getValidateContainer(container).appendChild(holder);\n  render( /*#__PURE__*/React.createElement(WaveEffect, {\n    left: nodeRect.left,\n    top: nodeRect.top,\n    width: nodeRect.width,\n    height: nodeRect.height,\n    color: waveColor,\n    className: className,\n    scale: scale,\n    borderRadius: [borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius].map(radius => validateNum(parseFloat(radius) * scale))\n  }), holder);\n}"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,SAAS,MAAM,WAAW;AACjC,SAASC,MAAM,EAAEC,OAAO,QAAQ,yBAAyB;AACzD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,QAAQ;AACjE,IAAMC,UAAU,GAAG,SAAbA,UAAU,CAAGC,KAAK,EAAI;EAC1B,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